while (($1 > 0))
do
	# delay: 600 seconds = 10 minutes
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[                    ] 10 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[##                  ] 09 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[####                ] 08 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[######              ] 07 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[########            ] 06 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[##########          ] 05 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[############        ] 04 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[##############      ] 03 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[################    ] 02 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[##################  ] 01 min"
	sleep 60;
	clear
	echo "Syncing mail every 10 Minutes"
	echo 
	echo "[####################] 00 min"

	# killing offlineimap in case it hang previously
	xterm -iconic -e "killall -s 9 offlineimap"

	# offlineimap fetches mail
	echo
	echo "============================="
	echo
	date
	echo "Syncing Mail..."
	offlineimap -u quiet &
	sleep 60;
done

#EOL
